<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function test(a) {
      console.log(a);
      var n = 1
      return function (b) {
        n++
        console.log(b)
        console.log('n=' + n);
      }
    }
    var fn = test(1)
    fn(5)
    fn(8)
  </script>
</body>

</html>